// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.11
package sys

import (
	"context"
	"hotgo/api/admin/auctionproductmapper"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	AuctionProductMapper = cAuctionProductMapper{}
)

type cAuctionProductMapper struct{}

// List 查看拍品管理列表
func (c *cAuctionProductMapper) List(ctx context.Context, req *auctionproductmapper.ListReq) (res *auctionproductmapper.ListRes, err error) {
	list, totalCount, err := service.SysAuctionProductMapper().List(ctx, &req.AuctionProductMapperListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.AuctionProductMapperListModel{}
	}

	res = new(auctionproductmapper.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出拍品管理列表
func (c *cAuctionProductMapper) Export(ctx context.Context, req *auctionproductmapper.ExportReq) (res *auctionproductmapper.ExportRes, err error) {
	err = service.SysAuctionProductMapper().Export(ctx, &req.AuctionProductMapperListInp)
	return
}

// Edit 更新拍品管理
func (c *cAuctionProductMapper) Edit(ctx context.Context, req *auctionproductmapper.EditReq) (res *auctionproductmapper.EditRes, err error) {
	err = service.SysAuctionProductMapper().Edit(ctx, &req.AuctionProductMapperEditInp)
	return
}

// View 获取指定拍品管理信息
func (c *cAuctionProductMapper) View(ctx context.Context, req *auctionproductmapper.ViewReq) (res *auctionproductmapper.ViewRes, err error) {
	data, err := service.SysAuctionProductMapper().View(ctx, &req.AuctionProductMapperViewInp)
	if err != nil {
		return
	}

	res = new(auctionproductmapper.ViewRes)
	res.AuctionProductMapperViewModel = data
	return
}

// Delete 删除拍品管理
func (c *cAuctionProductMapper) Delete(ctx context.Context, req *auctionproductmapper.DeleteReq) (res *auctionproductmapper.DeleteRes, err error) {
	err = service.SysAuctionProductMapper().Delete(ctx, &req.AuctionProductMapperDeleteInp)
	return
}